<?php
 
class userComponents extends sfComponents
{
  public function executeCommentlist()
  {
      if(empty($this->contentId))
          $this->contentId="1076";
      if(empty($this->contentTypeId))
          $this->contentTypeId="1003";
      //if(empty($this->recordCount))
          $this->recordCount="10";
      if(empty($this->currentPage))
          $this->currentPage="1";
      $query = Doctrine_Query::create()->from("Comment c")
              ->where('content_id='.$this->contentId)->andWhere('status_id=1005')->andWhere('c.content_type_i='.$this->contentTypeId);
      $query = $query   ->orderBy('c.create_time desc,c.modify_time desc');
      $this->pages = new sfDoctrinePager('Comment',$this->recordCount);//$this->currentPage
      $this->pages->setQuery($query);  //$q   数据库查询语句
      $this->pages->setPage($this->currentPage);//
      $this->pages->init();
  }
  public function executeComment()
  {

  }
  public function executeHomeinfo(sfWebRequest $request)
  {
      $this->userId;
      if($this->str=="mypwd")
      {}
      if($this->str=="myinfo1")
      {}
      if($this->str=="myinfo2")
      {}
  }

  public function executeModifyinfo()
  {
  }

  public function executeUserinfo()
  {
      if($this->getUser()->getAttribute('userId')>0)
      {
          if(empty($this->contentId))
              $this->contentId="1076";
          if(empty($this->contentTypeId))
              $this->contentTypeId="1003";
          if(empty($this->recordCount))
              $this->recordCount="20";
          if(empty($this->currentPage))
              $this->currentPage="1";
          $query = Doctrine_Query::create()->from("Comment c")
                  ->where('content_id='.$this->contentId)->andWhere('c.content_type_i='.$this->contentTypeId);
          $query = $query   ->orderBy('c.create_time desc,c.modify_time desc');
          $this->pages = new sfDoctrinePager('Comment',$this->recordCount);//$this->currentPage
          $this->pages->setQuery($query);  //$q   数据库查询语句
          $this->pages->setPage($this->currentPage);//
          $this->pages->init();

          $this->userInf=@Doctrine_Query::create()->from('Users')->where("user_id='".$this->getUser()->getAttribute('userId')."'")->fetchOne('name');
      }
  }
}